﻿using System;
using System.IO;

namespace SharpOSCAR.Base
{
    /// <summary>
    /// Represents a U8 (byte) data type
    /// </summary>
    public class U8 : ProtocolData
    {
        private byte _Value;
        /// <summary>
        /// Value
        /// </summary>
        public byte Value
        {
            get { return _Value; }
            set { _Value = value; }
        }

        /// <summary>
        /// Initializes the U8 data type with the specified value
        /// </summary>
        /// <param name="value">Value</param>
        public U8(byte value)
        {
            _Value = value;
        }

        /// <summary>
        /// Converts the U8 into a byte array
        /// </summary>
        /// <returns>Returns a byte array representing the U8</returns>
        public override byte[] ToByteArray()
        {
            return new byte[] { _Value };
        }
    }
}
